#include "rb_iup.h"

#ifdef _MSC_VER
int main(int argc, char **argv) {
return 0;
}
#endif

DLLEXPORT void Init_iup()
{
	VALUE VERSION = rb_str_new2("0.1.0");
	rb_mIup = rb_define_module("Iup");	
	rb_mCd = rb_define_module("Cd");
	rb_define_const(rb_mIup, "RUBY_IUP_VERSION", VERSION);
 
	rb_eIupError = rb_define_class_under(rb_mIup, "IupError", rb_eStandardError);

	rb_cIupNode = rb_define_class_under(rb_mIup, "Node", rb_cObject); 
	rb_cIupFileDlg = rb_define_class_under(rb_mIup, "FileDlg", rb_cIupNode); 
	rb_cIupImage = rb_define_class_under(rb_mIup, "Image", rb_cIupNode); 
	rb_cIupButton = rb_define_class_under(rb_mIup, "Button", rb_cIupNode); 
	rb_cIupCanvas = rb_define_class_under(rb_mIup, "Canvas", rb_cIupNode); 
	rb_cIupDialog = rb_define_class_under(rb_mIup, "Dialog", rb_cIupNode); 
	rb_cIupFill = rb_define_class_under(rb_mIup, "Fill", rb_cIupNode); 
	rb_cIupFrame = rb_define_class_under(rb_mIup, "Frame", rb_cIupNode); 
	rb_cIupHbox = rb_define_class_under(rb_mIup, "Hbox", rb_cIupNode); 
	rb_cIupItem = rb_define_class_under(rb_mIup, "Item", rb_cIupNode); 
	rb_cIupSeparator = rb_define_class_under(rb_mIup, "Separator", rb_cIupNode); 
	rb_cIupSubmenu = rb_define_class_under(rb_mIup, "Submenu", rb_cIupNode); 
	rb_cIupLabel = rb_define_class_under(rb_mIup, "Label", rb_cIupNode); 
	rb_cIupList = rb_define_class_under(rb_mIup, "List", rb_cIupNode); 
	rb_cIupMenu = rb_define_class_under(rb_mIup, "Menu", rb_cIupNode); 
	rb_cIupRadio = rb_define_class_under(rb_mIup, "Radio", rb_cIupNode); 
	rb_cIupText = rb_define_class_under(rb_mIup, "Text", rb_cIupNode); 
	rb_cIupToggle = rb_define_class_under(rb_mIup, "Toggle", rb_cIupNode); 
	rb_cIupVbox = rb_define_class_under(rb_mIup, "Vbox", rb_cIupNode); 
	rb_cIupZbox = rb_define_class_under(rb_mIup, "Zbox", rb_cIupNode); 
	rb_cIupMultiLine = rb_define_class_under(rb_mIup, "MultiLine", rb_cIupNode); 
	rb_cIupUser = rb_define_class_under(rb_mIup, "User", rb_cIupNode); 
	rb_cIupControl = rb_define_class_under(rb_mIup, "Control", rb_cIupNode); 
	rb_cIupTree = rb_define_class_under(rb_mIup, "Tree", rb_cIupNode); 
	rb_cIupTabs = rb_define_class_under(rb_mIup, "Tabs", rb_cIupCanvas); 
	rb_cIupGLCanvas = rb_define_class_under(rb_mIup, "GLCanvas", rb_cIupCanvas); 
	rb_cIupSpin = rb_define_class_under(rb_mIup, "Spin", rb_cIupNode); 
	rb_cIupSpinbox = rb_define_class_under(rb_mIup, "Spinbox", rb_cIupNode); 
	rb_cIupSbox = rb_define_class_under(rb_mIup, "Sbox", rb_cIupNode); 
	rb_cIupCbox = rb_define_class_under(rb_mIup, "Cbox", rb_cIupNode); 
	rb_cIupMatrix = rb_define_class_under(rb_mIup, "Matrix", rb_cIupCanvas); 
	rb_cIupGauge = rb_define_class_under(rb_mIup, "Gauge", rb_cIupCanvas); 
	rb_cIupDial = rb_define_class_under(rb_mIup, "Dial", rb_cIupCanvas); 
	rb_cIupColorbar = rb_define_class_under(rb_mIup, "Colorbar", rb_cIupCanvas); 
	rb_cIupColorBrowser = rb_define_class_under(rb_mIup, "ColorBrowser", rb_cIupCanvas); 
	rb_cIupCells = rb_define_class_under(rb_mIup, "Cells", rb_cIupCanvas); 
	rb_cIupPPlot = rb_define_class_under(rb_mIup, "PPlot", rb_cIupCanvas); 
	rb_cIupVal = rb_define_class_under(rb_mIup, "Val", rb_cIupCanvas); 
	rb_cIupTimer = rb_define_class_under(rb_mIup, "Timer", rb_cIupNode); 
	rb_cIupProgressBar = rb_define_class_under(rb_mIup, "ProgressBar", rb_cIupNode); 
	
	rb_define_const(rb_mIup, "NAME", rb_str_new2(IUP_NAME));
	rb_define_const(rb_mIup, "COPYRIGHT", rb_str_new2(IUP_COPYRIGHT));
	rb_define_const(rb_mIup, "DESCRIPTION", rb_str_new2(IUP_DESCRIPTION));
	rb_define_const(rb_mIup, "VERSION", rb_str_new2(IUP_VERSION));
	rb_define_const(rb_mIup, "VERSION_DATE", rb_str_new2(IUP_VERSION_DATE));
	rb_define_const(rb_mIup, "VERSION_NUMBER", INT2FIX(IUP_VERSION_NUMBER));
	
	rb_cCdCanvas = rb_define_class_under(rb_mCd, "CdCanvas", rb_cObject); 
	rb_define_method(rb_cCdCanvas, "initialize", rb_cCdCanvas_initialize, 1); 
	rb_define_const(rb_mCd, "NAME", rb_str_new2(CD_NAME));
	rb_define_const(rb_mCd, "COPYRIGHT", rb_str_new2(CD_COPYRIGHT));
	rb_define_const(rb_mCd, "DESCRIPTION", rb_str_new2(CD_DESCRIPTION));
	rb_define_const(rb_mCd, "VERSION", rb_str_new2(CD_VERSION));
	rb_define_const(rb_mCd, "VERSION_DATE", rb_str_new2(CD_VERSION_DATE));
	rb_define_const(rb_mCd, "VERSION_NUMBER", INT2FIX(CD_VERSION_NUMBER));
	
	rb_define_attr(rb_cIupNode, "ihandle", 1, 0);
	rb_define_attr(rb_cCdCanvas, "canvas", 1, 0);
	rb_undef_method(rb_cIupNode, "type"); 
	rb_define_method(rb_cIupNode, "method_missing", rb_method_missing, -1); 
	rb_define_method(rb_cIupNode, "[]", rb_IupGetAttribute, 1); 
	rb_define_method(rb_cIupNode, "[]=", rb_IupSetAttribute, 2); 
	rb_define_module_function(rb_mIup, "isxkey", rb_isxkey, 1);
	rb_define_module_function(rb_mIup, "isshift", rb_isshift, 1);
	rb_define_module_function(rb_mIup, "iscontrol", rb_iscontrol, 1);
	rb_define_module_function(rb_mIup, "isbutton1", rb_isbutton1, 1);
	rb_define_module_function(rb_mIup, "isbutton2", rb_isbutton2, 1);
	rb_define_module_function(rb_mIup, "isbutton3", rb_isbutton3, 1);
	rb_define_module_function(rb_mIup, "isdouble", rb_isdouble, 1);
	rb_define_module_function(rb_mIup, "isalt", rb_isalt, 1);
	rb_define_module_function(rb_mIup, "issys", rb_issys, 1);
	rb_define_module_function(rb_mIup, "isbutton4", rb_isbutton4, 1);
	rb_define_module_function(rb_mIup, "isbutton5", rb_isbutton5, 1);
	
	rb_define_module_function(rb_mIup, "FileDlg", rb_IupFileDlg, -1);
	rb_define_module_function(rb_mIup, "GetFile", rb_IupGetFile, 1);
	rb_define_module_function(rb_mIup, "Message", rb_IupMessage, 2);
	rb_define_module_function(rb_mIup, "Messagef", rb_IupMessagef, -1);
	rb_define_module_function(rb_mIup, "Alarm", rb_IupAlarm, 5);
	rb_define_module_function(rb_mIup, "Scanf", rb_IupScanf, -1);
	rb_define_module_function(rb_mIup, "ListDialog", rb_IupListDialog, 8);
	rb_define_module_function(rb_mIup, "GetText", rb_IupGetText, 2);
	rb_define_module_function(rb_mIup, "Open", rb_IupOpen, 0);
	rb_define_module_function(rb_mIup, "Close", rb_IupClose, 0);
	rb_define_module_function(rb_mIup, "MainLoop", rb_IupMainLoop, 0);
	rb_define_module_function(rb_mIup, "LoopStep", rb_IupLoopStep, 0);
	rb_define_module_function(rb_mIup, "Flush", rb_IupFlush, 0);
	rb_define_module_function(rb_mIup, "ExitLoop", rb_IupExitLoop, 0);
	rb_define_module_function(rb_mIup, "Update", rb_IupUpdate, 1);
	rb_define_module_function(rb_mIup, "Refresh", rb_IupRefresh, 1);
	rb_define_module_function(rb_mIup, "MapFont", rb_IupMapFont, 1);
	rb_define_module_function(rb_mIup, "UnMapFont", rb_IupUnMapFont, 1);
	rb_define_module_function(rb_mIup, "Help", rb_IupHelp, 1);
	rb_define_module_function(rb_mIup, "Version", rb_IupVersion, 0);
	rb_define_module_function(rb_mIup, "VersionDate", rb_IupVersionDate, 0);
	rb_define_module_function(rb_mIup, "VersionNumber", rb_IupVersionNumber, 0);
	rb_define_module_function(rb_mIup, "SetLanguage", rb_IupSetLanguage, 1);
	rb_define_module_function(rb_mIup, "GetLanguage", rb_IupGetLanguage, 0);
	rb_define_method(rb_cIupNode, "Destroy", rb_IupDestroy, 0);
	rb_define_module_function(rb_mIup, "Detach", rb_IupDetach, 1);
	rb_define_module_function(rb_mIup, "Append", rb_IupAppend, 2);
	rb_define_module_function(rb_mIup, "GetNextChild", rb_IupGetNextChild, 2);
	rb_define_module_function(rb_mIup, "GetBrother", rb_IupGetBrother, 1);
	rb_define_module_function(rb_mIup, "GetParent", rb_IupGetParent, 1);
	rb_define_module_function(rb_mIup, "GetDialog", rb_IupGetDialog, 1);
	rb_define_method(rb_cIupNode, "Popup", rb_IupPopup, 2);
	rb_define_method(rb_cIupNode, "Show", rb_IupShow, 0);
	rb_define_method(rb_cIupNode, "ShowXY", rb_IupShowXY, 2);
	rb_define_method(rb_cIupNode, "Hide", rb_IupHide, 0);
	rb_define_method(rb_cIupNode, "Map", rb_IupMap, 0);
	rb_define_method(rb_cIupNode, "SetAttribute", rb_IupSetAttribute, 2);
	rb_define_method(rb_cIupNode, "SetAttributePtr", rb_IupSetAttributePtr, 2);
	rb_define_method(rb_cIupNode, "StoreAttribute", rb_IupStoreAttribute, 2);
	rb_define_method(rb_cIupNode, "SetAttributes", rb_IupSetAttributes, 1);
	rb_define_method(rb_cIupNode, "GetAttribute", rb_IupGetAttribute, 1);
	rb_define_method(rb_cIupNode, "GetAttributePtr", rb_IupGetAttributePtr, 1);
	rb_define_method(rb_cIupNode, "GetNode", rb_IupGetAttributePtr, 1);
	rb_define_method(rb_cIupNode, "GetAttributes", rb_IupGetAttributes, 0);
	rb_define_method(rb_cIupNode, "GetInt", rb_IupGetInt, 1);
	rb_define_method(rb_cIupNode, "GetFloat", rb_IupGetFloat, 1);
	rb_define_module_function(rb_mIup, "SetGlobal", rb_IupSetGlobal, 2);
	rb_define_module_function(rb_mIup, "StoreGlobal", rb_IupStoreGlobal, 2);
	rb_define_module_function(rb_mIup, "GetGlobal", rb_IupGetGlobal, 1);
	rb_define_module_function(rb_mIup, "SetFocus", rb_IupSetFocus, 1);
	rb_define_module_function(rb_mIup, "GetFocus", rb_IupGetFocus, 0);
	rb_define_module_function(rb_mIup, "PreviousField", rb_IupPreviousField, 1);
	rb_define_module_function(rb_mIup, "NextField", rb_IupNextField, 1);
	rb_define_method(rb_cIupNode, "GetCallback", rb_IupGetCallback, 1);
	rb_define_method(rb_cIupNode, "SetCallback", rb_IupSetCallback, 2);
	rb_define_module_function(rb_mIup, "GetFunction", rb_IupGetFunction, 1);
	rb_define_module_function(rb_mIup, "SetFunction", rb_IupSetFunction, 2);
	rb_define_module_function(rb_mIup, "SetIdle", rb_IupSetIdle, 1);
	rb_define_module_function(rb_mIup, "GetIdle", rb_IupGetIdle, 0);
	rb_define_module_function(rb_mIup, "GetActionName", rb_IupGetActionName, 0);
	rb_define_module_function(rb_mIup, "GetHandle", rb_IupGetHandle, 1);
	rb_define_module_function(rb_mIup, "SetHandle", rb_IupSetHandle, 2);
	rb_define_module_function(rb_mIup, "GetAllNames", rb_IupGetAllNames, 1);
	rb_define_module_function(rb_mIup, "GetAllDialogs", rb_IupGetAllDialogs, 1);
	rb_define_module_function(rb_mIup, "GetName", rb_IupGetName, 1);
	rb_define_method(rb_cIupNode, "SetAttributeHandle", rb_IupSetAttributeHandle, 2);
	rb_define_method(rb_cIupNode, "GetAttributeHandle", rb_IupGetAttributeHandle, 1);
	rb_define_method(rb_cIupNode, "GetClassName", rb_IupGetClassName, 0);
	//rb_define_module_function(rb_mIup, "Create", rb_IupCreate, 1);
	//rb_define_module_function(rb_mIup, "Createv", rb_IupCreatev, -1);
	
	rb_define_method(rb_cIupNode, "initialize", rb_IupNode_initialize, -1); 
	rb_define_module_function(rb_mIup, "Fill", rb_IupFill, -1);
	rb_define_module_function(rb_mIup, "Radio", rb_IupRadio, -1);
	rb_define_module_function(rb_mIup, "Vbox", rb_IupVboxv, -1);
	rb_define_module_function(rb_mIup, "Zbox", rb_IupZboxv, -1);
	rb_define_module_function(rb_mIup, "Hbox", rb_IupHboxv, -1);
	rb_define_module_function(rb_mIup, "Frame", rb_IupFrame, -1);
	rb_define_module_function(rb_mIup, "Image", rb_IupImage, -1);
	rb_define_module_function(rb_mIup, "Button", rb_IupButton, -1);
	rb_define_module_function(rb_mIup, "Canvas", rb_IupCanvas, -1);
	rb_define_module_function(rb_mIup, "Dialog", rb_IupDialog, -1);
	rb_define_module_function(rb_mIup, "User", rb_IupUser, 0);
	rb_define_module_function(rb_mIup, "Item", rb_IupItem, -1);
	rb_define_module_function(rb_mIup, "Submenu", rb_IupSubmenu, -1);
	rb_define_module_function(rb_mIup, "Separator", rb_IupSeparator, 0);
	rb_define_module_function(rb_mIup, "Label", rb_IupLabel, -1);
	rb_define_module_function(rb_mIup, "List", rb_IupList, -1);
	rb_define_module_function(rb_mIup, "Menu", rb_IupMenuv, 1);
	rb_define_module_function(rb_mIup, "Text", rb_IupText, -1);
	rb_define_module_function(rb_mIup, "MultiLine", rb_IupMultiLine, -1);
	rb_define_module_function(rb_mIup, "Toggle", rb_IupToggle, -1);
	rb_define_module_function(rb_mIup, "Timer", rb_IupTimer, 0);
	rb_define_module_function(rb_mIup, "ProgressBar", rb_IupProgressBar, 0);
	rb_define_const(rb_mIup, "ERROR", INT2FIX(IUP_ERROR));
	rb_define_const(rb_mIup, "NOERROR", INT2FIX(IUP_NOERROR));
	rb_define_const(rb_mIup, "OPENED", INT2FIX(IUP_OPENED));
	rb_define_const(rb_mIup, "INVALID", INT2FIX(IUP_INVALID));
	rb_define_const(rb_mIup, "IGNORE", INT2FIX(IUP_IGNORE));
	rb_define_const(rb_mIup, "DEFAULT", INT2FIX(IUP_DEFAULT));
	rb_define_const(rb_mIup, "CLOSE", INT2FIX(IUP_CLOSE));
	rb_define_const(rb_mIup, "CONTINUE", INT2FIX(IUP_CONTINUE));
	rb_define_const(rb_mIup, "CENTER", INT2FIX(IUP_CENTER));
	rb_define_const(rb_mIup, "LEFT", INT2FIX(IUP_LEFT));
	rb_define_const(rb_mIup, "RIGHT", INT2FIX(IUP_RIGHT));
	rb_define_const(rb_mIup, "MOUSEPOS", INT2FIX(IUP_MOUSEPOS));
	rb_define_const(rb_mIup, "CURRENT", INT2FIX(IUP_CURRENT));
	rb_define_const(rb_mIup, "CENTERPARENT", INT2FIX(IUP_CENTERPARENT));
	rb_define_const(rb_mIup, "TOP", INT2FIX(IUP_TOP));
	rb_define_const(rb_mIup, "BOTTOM", INT2FIX(IUP_BOTTOM));
	rb_define_const(rb_mIup, "BUTTON1", INT2FIX(IUP_BUTTON1));
	rb_define_const(rb_mIup, "BUTTON2", INT2FIX(IUP_BUTTON2));
	rb_define_const(rb_mIup, "BUTTON3", INT2FIX(IUP_BUTTON3));
	rb_define_const(rb_mIup, "BUTTON4", INT2FIX(IUP_BUTTON4));
	rb_define_const(rb_mIup, "BUTTON5", INT2FIX(IUP_BUTTON5));
 
	rb_define_module_function(rb_mIup, "ColorBrowser", rb_IupColorBrowser, 0);

	rb_define_module_function(rb_mIup, "Cbox", rb_IupCboxv, -1);

	rb_define_module_function(rb_mIup, "Cells", rb_IupCells, -1);

	rb_define_const(rb_mIup, "PRIMARY", INT2FIX(IUP_PRIMARY));
	rb_define_const(rb_mIup, "SECONDARY", INT2FIX(IUP_SECONDARY));
	rb_define_module_function(rb_mIup, "Colorbar", rb_IupColorbar, 0);

	rb_define_module_function(rb_mIup, "ControlsOpen", rb_IupControlsOpen, 0);
	rb_define_module_function(rb_mIup, "ControlsClose", rb_IupControlsClose, 0);
	rb_define_module_function(rb_mIup, "ImageLibOpen", rb_IupImageLibOpen, 0);


	rb_define_const(rb_mIup, "ICTL_MOUSEMOVE_CB", rb_str_new2(ICTL_MOUSEMOVE_CB));
	rb_define_const(rb_mIup, "ICTL_BUTTON_PRESS_CB", rb_str_new2(ICTL_BUTTON_PRESS_CB));
	rb_define_const(rb_mIup, "ICTL_BUTTON_RELEASE_CB", rb_str_new2(ICTL_BUTTON_RELEASE_CB));
	rb_define_const(rb_mIup, "ICTL_DENSITY", rb_str_new2(ICTL_DENSITY));
	rb_define_const(rb_mIup, "ICTL_HORIZONTAL", rb_str_new2(ICTL_HORIZONTAL));
	rb_define_const(rb_mIup, "ICTL_VERTICAL", rb_str_new2(ICTL_VERTICAL));
	rb_define_const(rb_mIup, "ICTL_CIRCULAR", rb_str_new2(ICTL_CIRCULAR));
	rb_define_const(rb_mIup, "ICTL_UNIT", rb_str_new2(ICTL_UNIT));
	rb_define_module_function(rb_mIup, "Dial", rb_IupDial, -1);

	rb_define_const(rb_mIup, "ICTL_SHOW_TEXT", rb_str_new2(ICTL_SHOW_TEXT));
	rb_define_const(rb_mIup, "ICTL_DASHED", rb_str_new2(ICTL_DASHED));
	rb_define_const(rb_mIup, "ICTL_MARGIN", rb_str_new2(ICTL_MARGIN));
	rb_define_const(rb_mIup, "ICTL_TEXT", rb_str_new2(ICTL_TEXT));
	rb_define_module_function(rb_mIup, "Gauge", rb_IupGauge, -1);

	rb_define_module_function(rb_mIup, "GetColor", rb_IupGetColor, 2);

	rb_define_module_function(rb_mIup, "GetParam", rb_IupGetParam, -1);

	rb_define_module_function(rb_mIup, "GLCanvasOpen", rb_IupGLCanvasOpen, 0);
	rb_define_module_function(rb_mIup, "GLCanvas", rb_IupGLCanvas, -1);
	rb_define_module_function(rb_mIup, "GLMakeCurrent", rb_IupGLMakeCurrent, 1);
	rb_define_module_function(rb_mIup, "GLIsCurrent", rb_IupGLIsCurrent, 1);
	rb_define_module_function(rb_mIup, "GLSwapBuffers", rb_IupGLSwapBuffers, 1);
	rb_define_module_function(rb_mIup, "GLPalette", rb_IupGLPalette, 5);

	rb_define_module_function(rb_mIup, "LoadImage", rb_IupLoadImage, 1);
	rb_define_module_function(rb_mIup, "SaveImage", rb_IupSaveImage, 3);

	rb_define_const(rb_mIup, "K_exclam", INT2FIX(K_exclam));
	rb_define_const(rb_mIup, "K_quotedbl", INT2FIX(K_quotedbl));
	rb_define_const(rb_mIup, "K_numbersign", INT2FIX(K_numbersign));
	rb_define_const(rb_mIup, "K_dollar", INT2FIX(K_dollar));
	rb_define_const(rb_mIup, "K_percent", INT2FIX(K_percent));
	rb_define_const(rb_mIup, "K_ampersand", INT2FIX(K_ampersand));
	rb_define_const(rb_mIup, "K_quoteright", INT2FIX(K_quoteright));
	rb_define_const(rb_mIup, "K_parentleft", INT2FIX(K_parentleft));
	rb_define_const(rb_mIup, "K_parentright", INT2FIX(K_parentright));
	rb_define_const(rb_mIup, "K_asterisk", INT2FIX(K_asterisk));
	rb_define_const(rb_mIup, "K_plus", INT2FIX(K_plus));
	rb_define_const(rb_mIup, "K_comma", INT2FIX(K_comma));
	rb_define_const(rb_mIup, "K_minus", INT2FIX(K_minus));
	rb_define_const(rb_mIup, "K_period", INT2FIX(K_period));
	rb_define_const(rb_mIup, "K_slash", INT2FIX(K_slash));
	rb_define_const(rb_mIup, "K_0", INT2FIX(K_0));
	rb_define_const(rb_mIup, "K_1", INT2FIX(K_1));
	rb_define_const(rb_mIup, "K_2", INT2FIX(K_2));
	rb_define_const(rb_mIup, "K_3", INT2FIX(K_3));
	rb_define_const(rb_mIup, "K_4", INT2FIX(K_4));
	rb_define_const(rb_mIup, "K_5", INT2FIX(K_5));
	rb_define_const(rb_mIup, "K_6", INT2FIX(K_6));
	rb_define_const(rb_mIup, "K_7", INT2FIX(K_7));
	rb_define_const(rb_mIup, "K_8", INT2FIX(K_8));
	rb_define_const(rb_mIup, "K_9", INT2FIX(K_9));
	rb_define_const(rb_mIup, "K_colon", INT2FIX(K_colon));
	rb_define_const(rb_mIup, "K_semicolon", INT2FIX(K_semicolon));
	rb_define_const(rb_mIup, "K_less", INT2FIX(K_less));
	rb_define_const(rb_mIup, "K_equal", INT2FIX(K_equal));
	rb_define_const(rb_mIup, "K_greater", INT2FIX(K_greater));
	rb_define_const(rb_mIup, "K_question", INT2FIX(K_question));
	rb_define_const(rb_mIup, "K_at", INT2FIX(K_at));
	rb_define_const(rb_mIup, "K_A", INT2FIX(K_A));
	rb_define_const(rb_mIup, "K_B", INT2FIX(K_B));
	rb_define_const(rb_mIup, "K_C", INT2FIX(K_C));
	rb_define_const(rb_mIup, "K_D", INT2FIX(K_D));
	rb_define_const(rb_mIup, "K_E", INT2FIX(K_E));
	rb_define_const(rb_mIup, "K_F", INT2FIX(K_F));
	rb_define_const(rb_mIup, "K_G", INT2FIX(K_G));
	rb_define_const(rb_mIup, "K_H", INT2FIX(K_H));
	rb_define_const(rb_mIup, "K_I", INT2FIX(K_I));
	rb_define_const(rb_mIup, "K_J", INT2FIX(K_J));
	rb_define_const(rb_mIup, "K_K", INT2FIX(K_K));
	rb_define_const(rb_mIup, "K_L", INT2FIX(K_L));
	rb_define_const(rb_mIup, "K_M", INT2FIX(K_M));
	rb_define_const(rb_mIup, "K_N", INT2FIX(K_N));
	rb_define_const(rb_mIup, "K_O", INT2FIX(K_O));
	rb_define_const(rb_mIup, "K_P", INT2FIX(K_P));
	rb_define_const(rb_mIup, "K_Q", INT2FIX(K_Q));
	rb_define_const(rb_mIup, "K_R", INT2FIX(K_R));
	rb_define_const(rb_mIup, "K_S", INT2FIX(K_S));
	rb_define_const(rb_mIup, "K_T", INT2FIX(K_T));
	rb_define_const(rb_mIup, "K_U", INT2FIX(K_U));
	rb_define_const(rb_mIup, "K_V", INT2FIX(K_V));
	rb_define_const(rb_mIup, "K_W", INT2FIX(K_W));
	rb_define_const(rb_mIup, "K_X", INT2FIX(K_X));
	rb_define_const(rb_mIup, "K_Y", INT2FIX(K_Y));
	rb_define_const(rb_mIup, "K_Z", INT2FIX(K_Z));
	rb_define_const(rb_mIup, "K_bracketleft", INT2FIX(K_bracketleft));
	rb_define_const(rb_mIup, "K_backslash", INT2FIX(K_backslash));
	rb_define_const(rb_mIup, "K_bracketright", INT2FIX(K_bracketright));
	rb_define_const(rb_mIup, "K_circum", INT2FIX(K_circum));
	rb_define_const(rb_mIup, "K_underscore", INT2FIX(K_underscore));
	rb_define_const(rb_mIup, "K_quoteleft", INT2FIX(K_quoteleft));
	rb_define_const(rb_mIup, "K_a", INT2FIX(K_a));
	rb_define_const(rb_mIup, "K_b", INT2FIX(K_b));
	rb_define_const(rb_mIup, "K_c", INT2FIX(K_c));
	rb_define_const(rb_mIup, "K_d", INT2FIX(K_d));
	rb_define_const(rb_mIup, "K_e", INT2FIX(K_e));
	rb_define_const(rb_mIup, "K_f", INT2FIX(K_f));
	rb_define_const(rb_mIup, "K_g", INT2FIX(K_g));
	rb_define_const(rb_mIup, "K_h", INT2FIX(K_h));
	rb_define_const(rb_mIup, "K_i", INT2FIX(K_i));
	rb_define_const(rb_mIup, "K_j", INT2FIX(K_j));
	rb_define_const(rb_mIup, "K_k", INT2FIX(K_k));
	rb_define_const(rb_mIup, "K_l", INT2FIX(K_l));
	rb_define_const(rb_mIup, "K_m", INT2FIX(K_m));
	rb_define_const(rb_mIup, "K_n", INT2FIX(K_n));
	rb_define_const(rb_mIup, "K_o", INT2FIX(K_o));
	rb_define_const(rb_mIup, "K_p", INT2FIX(K_p));
	rb_define_const(rb_mIup, "K_q", INT2FIX(K_q));
	rb_define_const(rb_mIup, "K_r", INT2FIX(K_r));
	rb_define_const(rb_mIup, "K_s", INT2FIX(K_s));
	rb_define_const(rb_mIup, "K_t", INT2FIX(K_t));
	rb_define_const(rb_mIup, "K_u", INT2FIX(K_u));
	rb_define_const(rb_mIup, "K_v", INT2FIX(K_v));
	rb_define_const(rb_mIup, "K_w", INT2FIX(K_w));
	rb_define_const(rb_mIup, "K_x", INT2FIX(K_x));
	rb_define_const(rb_mIup, "K_y", INT2FIX(K_y));
	rb_define_const(rb_mIup, "K_z", INT2FIX(K_z));
	rb_define_const(rb_mIup, "K_braceleft", INT2FIX(K_braceleft));
	rb_define_const(rb_mIup, "K_bar", INT2FIX(K_bar));
	rb_define_const(rb_mIup, "K_braceright", INT2FIX(K_braceright));
	rb_define_const(rb_mIup, "K_tilde", INT2FIX(K_tilde));
	rb_define_const(rb_mIup, "K_cA", INT2FIX(K_cA));
	rb_define_const(rb_mIup, "K_cB", INT2FIX(K_cB));
	rb_define_const(rb_mIup, "K_cC", INT2FIX(K_cC));
	rb_define_const(rb_mIup, "K_cD", INT2FIX(K_cD));
	rb_define_const(rb_mIup, "K_cE", INT2FIX(K_cE));
	rb_define_const(rb_mIup, "K_cF", INT2FIX(K_cF));
	rb_define_const(rb_mIup, "K_cG", INT2FIX(K_cG));
	rb_define_const(rb_mIup, "K_cH", INT2FIX(K_cH));
	rb_define_const(rb_mIup, "K_cI", INT2FIX(K_cI));
	rb_define_const(rb_mIup, "K_cJ", INT2FIX(K_cJ));
	rb_define_const(rb_mIup, "K_cK", INT2FIX(K_cK));
	rb_define_const(rb_mIup, "K_cL", INT2FIX(K_cL));
	rb_define_const(rb_mIup, "K_cM", INT2FIX(K_cM));
	rb_define_const(rb_mIup, "K_cN", INT2FIX(K_cN));
	rb_define_const(rb_mIup, "K_cO", INT2FIX(K_cO));
	rb_define_const(rb_mIup, "K_cP", INT2FIX(K_cP));
	rb_define_const(rb_mIup, "K_cQ", INT2FIX(K_cQ));
	rb_define_const(rb_mIup, "K_cR", INT2FIX(K_cR));
	rb_define_const(rb_mIup, "K_cS", INT2FIX(K_cS));
	rb_define_const(rb_mIup, "K_cT", INT2FIX(K_cT));
	rb_define_const(rb_mIup, "K_cU", INT2FIX(K_cU));
	rb_define_const(rb_mIup, "K_cV", INT2FIX(K_cV));
	rb_define_const(rb_mIup, "K_cW", INT2FIX(K_cW));
	rb_define_const(rb_mIup, "K_cX", INT2FIX(K_cX));
	rb_define_const(rb_mIup, "K_cY", INT2FIX(K_cY));
	rb_define_const(rb_mIup, "K_cZ", INT2FIX(K_cZ));
	rb_define_const(rb_mIup, "K_mA", INT2FIX(K_mA));
	rb_define_const(rb_mIup, "K_mB", INT2FIX(K_mB));
	rb_define_const(rb_mIup, "K_mC", INT2FIX(K_mC));
	rb_define_const(rb_mIup, "K_mD", INT2FIX(K_mD));
	rb_define_const(rb_mIup, "K_mE", INT2FIX(K_mE));
	rb_define_const(rb_mIup, "K_mF", INT2FIX(K_mF));
	rb_define_const(rb_mIup, "K_mG", INT2FIX(K_mG));
	rb_define_const(rb_mIup, "K_mH", INT2FIX(K_mH));
	rb_define_const(rb_mIup, "K_mI", INT2FIX(K_mI));
	rb_define_const(rb_mIup, "K_mJ", INT2FIX(K_mJ));
	rb_define_const(rb_mIup, "K_mK", INT2FIX(K_mK));
	rb_define_const(rb_mIup, "K_mL", INT2FIX(K_mL));
	rb_define_const(rb_mIup, "K_mM", INT2FIX(K_mM));
	rb_define_const(rb_mIup, "K_mN", INT2FIX(K_mN));
	rb_define_const(rb_mIup, "K_mO", INT2FIX(K_mO));
	rb_define_const(rb_mIup, "K_mP", INT2FIX(K_mP));
	rb_define_const(rb_mIup, "K_mQ", INT2FIX(K_mQ));
	rb_define_const(rb_mIup, "K_mR", INT2FIX(K_mR));
	rb_define_const(rb_mIup, "K_mS", INT2FIX(K_mS));
	rb_define_const(rb_mIup, "K_mT", INT2FIX(K_mT));
	rb_define_const(rb_mIup, "K_mU", INT2FIX(K_mU));
	rb_define_const(rb_mIup, "K_mV", INT2FIX(K_mV));
	rb_define_const(rb_mIup, "K_mW", INT2FIX(K_mW));
	rb_define_const(rb_mIup, "K_mX", INT2FIX(K_mX));
	rb_define_const(rb_mIup, "K_mY", INT2FIX(K_mY));
	rb_define_const(rb_mIup, "K_mZ", INT2FIX(K_mZ));
	rb_define_const(rb_mIup, "K_BS", INT2FIX(K_BS));
	rb_define_const(rb_mIup, "K_CR", INT2FIX(K_CR));
	rb_define_const(rb_mIup, "K_sCR", INT2FIX(K_sCR));
	rb_define_const(rb_mIup, "K_ESC", INT2FIX(K_ESC));
	rb_define_const(rb_mIup, "K_SP", INT2FIX(K_SP));
	rb_define_const(rb_mIup, "K_TAB", INT2FIX(K_TAB));
	rb_define_const(rb_mIup, "K_sTAB", INT2FIX(K_sTAB));
	rb_define_const(rb_mIup, "K_cTAB", INT2FIX(K_cTAB));
	rb_define_const(rb_mIup, "K_mTAB", INT2FIX(K_mTAB));
	rb_define_const(rb_mIup, "K_PAUSE", INT2FIX(K_PAUSE));
	rb_define_const(rb_mIup, "K_HOME", INT2FIX(K_HOME));
	rb_define_const(rb_mIup, "K_UP", INT2FIX(K_UP));
	rb_define_const(rb_mIup, "K_PGUP", INT2FIX(K_PGUP));
	rb_define_const(rb_mIup, "K_LEFT", INT2FIX(K_LEFT));
	rb_define_const(rb_mIup, "K_MIDDLE", INT2FIX(K_MIDDLE));
	rb_define_const(rb_mIup, "K_RIGHT", INT2FIX(K_RIGHT));
	rb_define_const(rb_mIup, "K_END", INT2FIX(K_END));
	rb_define_const(rb_mIup, "K_DOWN", INT2FIX(K_DOWN));
	rb_define_const(rb_mIup, "K_PGDN", INT2FIX(K_PGDN));
	rb_define_const(rb_mIup, "K_INS", INT2FIX(K_INS));
	rb_define_const(rb_mIup, "K_DEL", INT2FIX(K_DEL));
	rb_define_const(rb_mIup, "K_sHOME", INT2FIX(K_sHOME));
	rb_define_const(rb_mIup, "K_sUP", INT2FIX(K_sUP));
	rb_define_const(rb_mIup, "K_sPGUP", INT2FIX(K_sPGUP));
	rb_define_const(rb_mIup, "K_sLEFT", INT2FIX(K_sLEFT));
	rb_define_const(rb_mIup, "K_sRIGHT", INT2FIX(K_sRIGHT));
	rb_define_const(rb_mIup, "K_sEND", INT2FIX(K_sEND));
	rb_define_const(rb_mIup, "K_sDOWN", INT2FIX(K_sDOWN));
	rb_define_const(rb_mIup, "K_sPGDN", INT2FIX(K_sPGDN));
	rb_define_const(rb_mIup, "K_sSP", INT2FIX(K_sSP));
	rb_define_const(rb_mIup, "K_sINS", INT2FIX(K_sINS));
	rb_define_const(rb_mIup, "K_sDEL", INT2FIX(K_sDEL));
	rb_define_const(rb_mIup, "K_cHOME", INT2FIX(K_cHOME));
	rb_define_const(rb_mIup, "K_cPGUP", INT2FIX(K_cPGUP));
	rb_define_const(rb_mIup, "K_cLEFT", INT2FIX(K_cLEFT));
	rb_define_const(rb_mIup, "K_cRIGHT", INT2FIX(K_cRIGHT));
	rb_define_const(rb_mIup, "K_cEND", INT2FIX(K_cEND));
	rb_define_const(rb_mIup, "K_cPGDN", INT2FIX(K_cPGDN));
	rb_define_const(rb_mIup, "K_cUP", INT2FIX(K_cUP));
	rb_define_const(rb_mIup, "K_cMIDDLE", INT2FIX(K_cMIDDLE));
	rb_define_const(rb_mIup, "K_cDOWN", INT2FIX(K_cDOWN));
	rb_define_const(rb_mIup, "K_cINS", INT2FIX(K_cINS));
	rb_define_const(rb_mIup, "K_cDEL", INT2FIX(K_cDEL));
	rb_define_const(rb_mIup, "K_cSP", INT2FIX(K_cSP));
	rb_define_const(rb_mIup, "K_mHOME", INT2FIX(K_mHOME));
	rb_define_const(rb_mIup, "K_mPGUP", INT2FIX(K_mPGUP));
	rb_define_const(rb_mIup, "K_mLEFT", INT2FIX(K_mLEFT));
	rb_define_const(rb_mIup, "K_mRIGHT", INT2FIX(K_mRIGHT));
	rb_define_const(rb_mIup, "K_mEND", INT2FIX(K_mEND));
	rb_define_const(rb_mIup, "K_mPGDN", INT2FIX(K_mPGDN));
	rb_define_const(rb_mIup, "K_mUP", INT2FIX(K_mUP));
	rb_define_const(rb_mIup, "K_mDOWN", INT2FIX(K_mDOWN));
	rb_define_const(rb_mIup, "K_mINS", INT2FIX(K_mINS));
	rb_define_const(rb_mIup, "K_mDEL", INT2FIX(K_mDEL));
	rb_define_const(rb_mIup, "K_F1", INT2FIX(K_F1));
	rb_define_const(rb_mIup, "K_F2", INT2FIX(K_F2));
	rb_define_const(rb_mIup, "K_F3", INT2FIX(K_F3));
	rb_define_const(rb_mIup, "K_F4", INT2FIX(K_F4));
	rb_define_const(rb_mIup, "K_F5", INT2FIX(K_F5));
	rb_define_const(rb_mIup, "K_F6", INT2FIX(K_F6));
	rb_define_const(rb_mIup, "K_F7", INT2FIX(K_F7));
	rb_define_const(rb_mIup, "K_F8", INT2FIX(K_F8));
	rb_define_const(rb_mIup, "K_F9", INT2FIX(K_F9));
	rb_define_const(rb_mIup, "K_F10", INT2FIX(K_F10));
	rb_define_const(rb_mIup, "K_F11", INT2FIX(K_F11));
	rb_define_const(rb_mIup, "K_F12", INT2FIX(K_F12));
	rb_define_const(rb_mIup, "K_sF1", INT2FIX(K_sF1));
	rb_define_const(rb_mIup, "K_sF2", INT2FIX(K_sF2));
	rb_define_const(rb_mIup, "K_sF3", INT2FIX(K_sF3));
	rb_define_const(rb_mIup, "K_sF4", INT2FIX(K_sF4));
	rb_define_const(rb_mIup, "K_sF5", INT2FIX(K_sF5));
	rb_define_const(rb_mIup, "K_sF6", INT2FIX(K_sF6));
	rb_define_const(rb_mIup, "K_sF7", INT2FIX(K_sF7));
	rb_define_const(rb_mIup, "K_sF8", INT2FIX(K_sF8));
	rb_define_const(rb_mIup, "K_sF9", INT2FIX(K_sF9));
	rb_define_const(rb_mIup, "K_sF10", INT2FIX(K_sF10));
	rb_define_const(rb_mIup, "K_sF11", INT2FIX(K_sF11));
	rb_define_const(rb_mIup, "K_sF12", INT2FIX(K_sF12));
	rb_define_const(rb_mIup, "K_cF1", INT2FIX(K_cF1));
	rb_define_const(rb_mIup, "K_cF2", INT2FIX(K_cF2));
	rb_define_const(rb_mIup, "K_cF3", INT2FIX(K_cF3));
	rb_define_const(rb_mIup, "K_cF4", INT2FIX(K_cF4));
	rb_define_const(rb_mIup, "K_cF5", INT2FIX(K_cF5));
	rb_define_const(rb_mIup, "K_cF6", INT2FIX(K_cF6));
	rb_define_const(rb_mIup, "K_cF7", INT2FIX(K_cF7));
	rb_define_const(rb_mIup, "K_cF8", INT2FIX(K_cF8));
	rb_define_const(rb_mIup, "K_cF9", INT2FIX(K_cF9));
	rb_define_const(rb_mIup, "K_cF10", INT2FIX(K_cF10));
	rb_define_const(rb_mIup, "K_cF11", INT2FIX(K_cF11));
	rb_define_const(rb_mIup, "K_cF12", INT2FIX(K_cF12));
	rb_define_const(rb_mIup, "K_mF1", INT2FIX(K_mF1));
	rb_define_const(rb_mIup, "K_mF2", INT2FIX(K_mF2));
	rb_define_const(rb_mIup, "K_mF3", INT2FIX(K_mF3));
	rb_define_const(rb_mIup, "K_mF4", INT2FIX(K_mF4));
	rb_define_const(rb_mIup, "K_mF5", INT2FIX(K_mF5));
	rb_define_const(rb_mIup, "K_mF6", INT2FIX(K_mF6));
	rb_define_const(rb_mIup, "K_mF7", INT2FIX(K_mF7));
	rb_define_const(rb_mIup, "K_mF8", INT2FIX(K_mF8));
	rb_define_const(rb_mIup, "K_mF9", INT2FIX(K_mF9));
	rb_define_const(rb_mIup, "K_mF10", INT2FIX(K_mF10));
	rb_define_const(rb_mIup, "K_mF11", INT2FIX(K_mF11));
	rb_define_const(rb_mIup, "K_mF12", INT2FIX(K_mF12));
	rb_define_const(rb_mIup, "K_m1", INT2FIX(K_m1));
	rb_define_const(rb_mIup, "K_m2", INT2FIX(K_m2));
	rb_define_const(rb_mIup, "K_m3", INT2FIX(K_m3));
	rb_define_const(rb_mIup, "K_m4", INT2FIX(K_m4));
	rb_define_const(rb_mIup, "K_m5", INT2FIX(K_m5));
	rb_define_const(rb_mIup, "K_m6", INT2FIX(K_m6));
	rb_define_const(rb_mIup, "K_m7", INT2FIX(K_m7));
	rb_define_const(rb_mIup, "K_m8", INT2FIX(K_m8));
	rb_define_const(rb_mIup, "K_m9", INT2FIX(K_m9));
	rb_define_const(rb_mIup, "K_m0", INT2FIX(K_m0));

	rb_define_module_function(rb_mIup, "Matrix", rb_IupMatrix, -1);
	rb_define_method(rb_cIupMatrix, "MatSetAttribute", rb_IupMatSetAttribute, 4);
	rb_define_method(rb_cIupMatrix, "MatStoreAttribute", rb_IupMatStoreAttribute, 4);
	rb_define_method(rb_cIupMatrix, "MatGetAttribute", rb_IupMatGetAttribute, 3);
	rb_define_method(rb_cIupMatrix, "MatGetInt", rb_IupMatGetInt, 3);
	rb_define_method(rb_cIupMatrix, "MatGetFloat", rb_IupMatGetFloat, 3);

	//rb_define_module_function(rb_mIup, "OleControl", rb_IupOleControl, 1);
	//rb_define_module_function(rb_mIup, "OleControlOpen", rb_IupOleControlOpen, 0);
	//rb_define_module_function(rb_mIup, "OleControl_getclass", rb_IupOleControl_getclass, 0);

	rb_define_module_function(rb_mIup, "Sbox", rb_IupSbox, -1);

	//rb_define_module_function(rb_mIup, "SpeechOpen", rb_IupSpeechOpen, 0);
	//rb_define_module_function(rb_mIup, "SpeechClose", rb_IupSpeechClose, 0);
	//rb_define_module_function(rb_mIup, "Speech", rb_IupSpeech, 0);

	rb_define_module_function(rb_mIup, "Spin", rb_IupSpin, 0);
	rb_define_module_function(rb_mIup, "Spinbox", rb_IupSpinbox, -1);

	rb_define_const(rb_mIup, "ICTL_TOP", rb_str_new2(ICTL_TOP));
	rb_define_const(rb_mIup, "ICTL_BOTTOM", rb_str_new2(ICTL_BOTTOM));
	rb_define_const(rb_mIup, "ICTL_LEFT", rb_str_new2(ICTL_LEFT));
	rb_define_const(rb_mIup, "ICTL_RIGHT", rb_str_new2(ICTL_RIGHT));
	rb_define_const(rb_mIup, "ICTL_TABTYPE", rb_str_new2(ICTL_TABTYPE));
	rb_define_const(rb_mIup, "ICTL_TABTITLE", rb_str_new2(ICTL_TABTITLE));
	rb_define_const(rb_mIup, "ICTL_TABSIZE", rb_str_new2(ICTL_TABSIZE));
	rb_define_const(rb_mIup, "ICTL_TABCHANGE_CB", rb_str_new2(ICTL_TABCHANGE_CB));
	rb_define_const(rb_mIup, "ICTL_FONT", rb_str_new2(ICTL_FONT));
	rb_define_const(rb_mIup, "ICTL_FONT_ACTIVE", rb_str_new2(ICTL_FONT_ACTIVE));
	rb_define_const(rb_mIup, "ICTL_FONT_INACTIVE", rb_str_new2(ICTL_FONT_INACTIVE));
	rb_define_module_function(rb_mIup, "Tabs", rb_IupTabsv, -1);

	rb_define_module_function(rb_mIup, "Tree", rb_IupTree, -1);
	rb_define_method(rb_mIup, "TreeSetUserId", rb_IupTreeSetUserId, 2);
	rb_define_method(rb_mIup, "TreeGetUserId", rb_IupTreeGetUserId, 1);
	rb_define_method(rb_mIup, "TreeGetId", rb_IupTreeGetId, 1);
	rb_define_method(rb_mIup, "TreeSetAttribute", rb_IupTreeSetAttribute, 3);
	rb_define_method(rb_mIup, "TreeStoreAttribute", rb_IupTreeStoreAttribute, 3);
	rb_define_method(rb_mIup, "TreeGetAttribute", rb_IupTreeGetAttribute, 2);
	rb_define_method(rb_mIup, "TreeGetInt", rb_IupTreeGetInt, 2);
	rb_define_method(rb_mIup, "TreeGetFloat", rb_IupTreeGetFloat, 2);

	rb_define_const(rb_mIup, "ICTL_SHOWTICKS", rb_str_new2(ICTL_SHOWTICKS));
	rb_define_module_function(rb_mIup, "Val", rb_IupVal, -1);

	rb_define_module_function(rb_mIup, "PPlotOpen", rb_IupPPlotOpen, 0);
	rb_define_module_function(rb_mIup, "PPlot", rb_IupPPlot, 0);
	rb_define_method(rb_cIupPPlot, "PPlotBegin", rb_IupPPlotBegin, 1);
	rb_define_method(rb_cIupPPlot, "PPlotAdd", rb_IupPPlotAdd, 2);
	rb_define_method(rb_cIupPPlot, "PPlotAddStr", rb_IupPPlotAddStr, 2);
	rb_define_method(rb_cIupPPlot, "PPlotEnd", rb_IupPPlotEnd, 0);
	rb_define_method(rb_cIupPPlot, "PPlotInsertStr", rb_IupPPlotInsertStr, 4);
	rb_define_method(rb_cIupPPlot, "PPlotInsert", rb_IupPPlotInsert, 4);
	rb_define_method(rb_cIupPPlot, "PPlotTransform", rb_IupPPlotTransform, 2);
	rb_define_method(rb_cIupPPlot, "PPlotPaintTo", rb_IupPPlotPaintTo, 1);

	rb_define_const(rb_mCd,"QUERY",INT2FIX(CD_QUERY));
	rb_define_const(rb_mCd,"RGB",INT2FIX(CD_RGB));
	rb_define_const(rb_mCd,"MAP",INT2FIX(CD_MAP));
	rb_define_const(rb_mCd,"RGBA",INT2FIX(CD_RGBA));
	rb_define_const(rb_mCd,"IRED",INT2FIX(CD_IRED));
	rb_define_const(rb_mCd,"IGREEN",INT2FIX(CD_IGREEN));
	rb_define_const(rb_mCd,"IBLUE",INT2FIX(CD_IBLUE));
	rb_define_const(rb_mCd,"IALPHA",INT2FIX(CD_IALPHA));
	rb_define_const(rb_mCd,"INDEX",INT2FIX(CD_INDEX));
	rb_define_const(rb_mCd,"COLORS",INT2FIX(CD_COLORS));
	rb_define_const(rb_mCd,"ERROR",INT2FIX(CD_ERROR));
	rb_define_const(rb_mCd,"OK",INT2FIX(CD_OK));
	rb_define_const(rb_mCd,"CLIPOFF",INT2FIX(CD_CLIPOFF));
	rb_define_const(rb_mCd,"CLIPAREA",INT2FIX(CD_CLIPAREA));
	rb_define_const(rb_mCd,"CLIPPOLYGON",INT2FIX(CD_CLIPPOLYGON));
	rb_define_const(rb_mCd,"CLIPREGION",INT2FIX(CD_CLIPREGION));
	rb_define_const(rb_mCd,"UNION",INT2FIX(CD_UNION));
	rb_define_const(rb_mCd,"INTERSECT",INT2FIX(CD_INTERSECT));
	rb_define_const(rb_mCd,"DIFFERENCE",INT2FIX(CD_DIFFERENCE));
	rb_define_const(rb_mCd,"NOTINTERSECT",INT2FIX(CD_NOTINTERSECT));
	rb_define_const(rb_mCd,"FILL",INT2FIX(CD_FILL));
	rb_define_const(rb_mCd,"OPEN_LINES",INT2FIX(CD_OPEN_LINES));
	rb_define_const(rb_mCd,"CLOSED_LINES",INT2FIX(CD_CLOSED_LINES));
	rb_define_const(rb_mCd,"CLIP",INT2FIX(CD_CLIP));
	rb_define_const(rb_mCd,"BEZIER",INT2FIX(CD_BEZIER));
	rb_define_const(rb_mCd,"REGION",INT2FIX(CD_REGION));
	rb_define_const(rb_mCd,"POLYCUSTOM",INT2FIX(CD_POLYCUSTOM));
	rb_define_const(rb_mCd,"EVENODD",INT2FIX(CD_EVENODD));
	rb_define_const(rb_mCd,"WINDING",INT2FIX(CD_WINDING));
	rb_define_const(rb_mCd,"MITER",INT2FIX(CD_MITER));
	rb_define_const(rb_mCd,"BEVEL",INT2FIX(CD_BEVEL));
	rb_define_const(rb_mCd,"ROUND",INT2FIX(CD_ROUND));
	rb_define_const(rb_mCd,"CAPFLAT",INT2FIX(CD_CAPFLAT));
	rb_define_const(rb_mCd,"CAPSQUARE",INT2FIX(CD_CAPSQUARE));
	rb_define_const(rb_mCd,"CAPROUND",INT2FIX(CD_CAPROUND));
	rb_define_const(rb_mCd,"OPAQUE",INT2FIX(CD_OPAQUE));
	rb_define_const(rb_mCd,"TRANSPARENT",INT2FIX(CD_TRANSPARENT));
	rb_define_const(rb_mCd,"REPLACE",INT2FIX(CD_REPLACE));
	rb_define_const(rb_mCd,"XOR",INT2FIX(CD_XOR));
	rb_define_const(rb_mCd,"NOT_XOR",INT2FIX(CD_NOT_XOR));
	rb_define_const(rb_mCd,"POLITE",INT2FIX(CD_POLITE));
	rb_define_const(rb_mCd,"FORCE",INT2FIX(CD_FORCE));
	rb_define_const(rb_mCd,"CONTINUOUS",INT2FIX(CD_CONTINUOUS));
	rb_define_const(rb_mCd,"DASHED",INT2FIX(CD_DASHED));
	rb_define_const(rb_mCd,"DOTTED",INT2FIX(CD_DOTTED));
	rb_define_const(rb_mCd,"DASH_DOT",INT2FIX(CD_DASH_DOT));
	rb_define_const(rb_mCd,"DASH_DOT_DOT",INT2FIX(CD_DASH_DOT_DOT));
	rb_define_const(rb_mCd,"CUSTOM",INT2FIX(CD_CUSTOM));
	rb_define_const(rb_mCd,"PLUS",INT2FIX(CD_PLUS));
	rb_define_const(rb_mCd,"STAR",INT2FIX(CD_STAR));
	rb_define_const(rb_mCd,"CIRCLE",INT2FIX(CD_CIRCLE));
	rb_define_const(rb_mCd,"X",INT2FIX(CD_X));
	rb_define_const(rb_mCd,"BOX",INT2FIX(CD_BOX));
	rb_define_const(rb_mCd,"DIAMOND",INT2FIX(CD_DIAMOND));
	rb_define_const(rb_mCd,"HOLLOW_CIRCLE",INT2FIX(CD_HOLLOW_CIRCLE));
	rb_define_const(rb_mCd,"HOLLOW_BOX",INT2FIX(CD_HOLLOW_BOX));
	rb_define_const(rb_mCd,"HOLLOW_DIAMOND",INT2FIX(CD_HOLLOW_DIAMOND));
	rb_define_const(rb_mCd,"HORIZONTAL",INT2FIX(CD_HORIZONTAL));
	rb_define_const(rb_mCd,"VERTICAL",INT2FIX(CD_VERTICAL));
	rb_define_const(rb_mCd,"FDIAGONAL",INT2FIX(CD_FDIAGONAL));
	rb_define_const(rb_mCd,"BDIAGONAL",INT2FIX(CD_BDIAGONAL));
	rb_define_const(rb_mCd,"CROSS",INT2FIX(CD_CROSS));
	rb_define_const(rb_mCd,"DIAGCROSS",INT2FIX(CD_DIAGCROSS));
	rb_define_const(rb_mCd,"SOLID",INT2FIX(CD_SOLID));
	rb_define_const(rb_mCd,"HATCH",INT2FIX(CD_HATCH));
	rb_define_const(rb_mCd,"STIPPLE",INT2FIX(CD_STIPPLE));
	rb_define_const(rb_mCd,"PATTERN",INT2FIX(CD_PATTERN));
	rb_define_const(rb_mCd,"HOLLOW",INT2FIX(CD_HOLLOW));
	rb_define_const(rb_mCd,"NORTH",INT2FIX(CD_NORTH));
	rb_define_const(rb_mCd,"SOUTH",INT2FIX(CD_SOUTH));
	rb_define_const(rb_mCd,"EAST",INT2FIX(CD_EAST));
	rb_define_const(rb_mCd,"WEST",INT2FIX(CD_WEST));
	rb_define_const(rb_mCd,"NORTH_EAST",INT2FIX(CD_NORTH_EAST));
	rb_define_const(rb_mCd,"NORTH_WEST",INT2FIX(CD_NORTH_WEST));
	rb_define_const(rb_mCd,"SOUTH_EAST",INT2FIX(CD_SOUTH_EAST));
	rb_define_const(rb_mCd,"SOUTH_WEST",INT2FIX(CD_SOUTH_WEST));
	rb_define_const(rb_mCd,"CENTER",INT2FIX(CD_CENTER));
	rb_define_const(rb_mCd,"BASE_LEFT",INT2FIX(CD_BASE_LEFT));
	rb_define_const(rb_mCd,"BASE_CENTER",INT2FIX(CD_BASE_CENTER));
	rb_define_const(rb_mCd,"BASE_RIGHT",INT2FIX(CD_BASE_RIGHT));
	rb_define_const(rb_mCd,"PLAIN",INT2FIX(CD_PLAIN));
	rb_define_const(rb_mCd,"BOLD",INT2FIX(CD_BOLD));
	rb_define_const(rb_mCd,"ITALIC",INT2FIX(CD_ITALIC));
	rb_define_const(rb_mCd,"UNDERLINE",INT2FIX(CD_UNDERLINE));
	rb_define_const(rb_mCd,"STRIKEOUT",INT2FIX(CD_STRIKEOUT));
	rb_define_const(rb_mCd,"BOLD_ITALIC",INT2FIX(CD_BOLD_ITALIC));
	rb_define_const(rb_mCd,"SMALL",INT2FIX(CD_SMALL));
	rb_define_const(rb_mCd,"STANDARD",INT2FIX(CD_STANDARD));
	rb_define_const(rb_mCd,"LARGE",INT2FIX(CD_LARGE));
	rb_define_const(rb_mCd,"CAP_NONE",INT2FIX(CD_CAP_NONE));
	rb_define_const(rb_mCd,"CAP_FLUSH",INT2FIX(CD_CAP_FLUSH));
	rb_define_const(rb_mCd,"CAP_CLEAR",INT2FIX(CD_CAP_CLEAR));
	rb_define_const(rb_mCd,"CAP_PLAY",INT2FIX(CD_CAP_PLAY));
	rb_define_const(rb_mCd,"CAP_YAXIS",INT2FIX(CD_CAP_YAXIS));
	rb_define_const(rb_mCd,"CAP_CLIPAREA",INT2FIX(CD_CAP_CLIPAREA));
	rb_define_const(rb_mCd,"CAP_CLIPPOLY",INT2FIX(CD_CAP_CLIPPOLY));
	rb_define_const(rb_mCd,"CAP_REGION",INT2FIX(CD_CAP_REGION));
	rb_define_const(rb_mCd,"CAP_RECT",INT2FIX(CD_CAP_RECT));
	rb_define_const(rb_mCd,"CAP_CHORD",INT2FIX(CD_CAP_CHORD));
	rb_define_const(rb_mCd,"CAP_IMAGERGB",INT2FIX(CD_CAP_IMAGERGB));
	rb_define_const(rb_mCd,"CAP_IMAGERGBA",INT2FIX(CD_CAP_IMAGERGBA));
	rb_define_const(rb_mCd,"CAP_IMAGEMAP",INT2FIX(CD_CAP_IMAGEMAP));
	rb_define_const(rb_mCd,"CAP_GETIMAGERGB",INT2FIX(CD_CAP_GETIMAGERGB));
	rb_define_const(rb_mCd,"CAP_IMAGESRV",INT2FIX(CD_CAP_IMAGESRV));
	rb_define_const(rb_mCd,"CAP_BACKGROUND",INT2FIX(CD_CAP_BACKGROUND));
	rb_define_const(rb_mCd,"CAP_BACKOPACITY",INT2FIX(CD_CAP_BACKOPACITY));
	rb_define_const(rb_mCd,"CAP_WRITEMODE",INT2FIX(CD_CAP_WRITEMODE));
	rb_define_const(rb_mCd,"CAP_LINESTYLE",INT2FIX(CD_CAP_LINESTYLE));
	rb_define_const(rb_mCd,"CAP_LINEWITH",INT2FIX(CD_CAP_LINEWITH));
	rb_define_const(rb_mCd,"CAP_FPRIMTIVES",INT2FIX(CD_CAP_FPRIMTIVES));
	rb_define_const(rb_mCd,"CAP_HATCH",INT2FIX(CD_CAP_HATCH));
	rb_define_const(rb_mCd,"CAP_STIPPLE",INT2FIX(CD_CAP_STIPPLE));
	rb_define_const(rb_mCd,"CAP_PATTERN",INT2FIX(CD_CAP_PATTERN));
	rb_define_const(rb_mCd,"CAP_FONT",INT2FIX(CD_CAP_FONT));
	rb_define_const(rb_mCd,"CAP_FONTDIM",INT2FIX(CD_CAP_FONTDIM));
	rb_define_const(rb_mCd,"CAP_TEXTSIZE",INT2FIX(CD_CAP_TEXTSIZE));
	rb_define_const(rb_mCd,"CAP_TEXTORIENTATION",INT2FIX(CD_CAP_TEXTORIENTATION));
	rb_define_const(rb_mCd,"CAP_PALETTE",INT2FIX(CD_CAP_PALETTE));
	rb_define_const(rb_mCd,"CAP_LINECAP",INT2FIX(CD_CAP_LINECAP));
	rb_define_const(rb_mCd,"CAP_LINEJOIN",INT2FIX(CD_CAP_LINEJOIN));
	rb_define_const(rb_mCd,"CAP_ALL",INT2FIX(CD_CAP_ALL));
	rb_define_const(rb_mCd,"SIZECB",INT2FIX(CD_SIZECB));
	rb_define_const(rb_mCd,"ABORT",INT2FIX(CD_ABORT));
	rb_define_const(rb_mCd,"CONTINUE",INT2FIX(CD_CONTINUE));
	rb_define_const(rb_mCd,"SIM_NONE",INT2FIX(CD_SIM_NONE));
	rb_define_const(rb_mCd,"SIM_LINE",INT2FIX(CD_SIM_LINE));
	rb_define_const(rb_mCd,"SIM_RECT",INT2FIX(CD_SIM_RECT));
	rb_define_const(rb_mCd,"SIM_BOX",INT2FIX(CD_SIM_BOX));
	rb_define_const(rb_mCd,"SIM_ARC",INT2FIX(CD_SIM_ARC));
	rb_define_const(rb_mCd,"SIM_SECTOR",INT2FIX(CD_SIM_SECTOR));
	rb_define_const(rb_mCd,"SIM_CHORD",INT2FIX(CD_SIM_CHORD));
	rb_define_const(rb_mCd,"SIM_POLYLINE",INT2FIX(CD_SIM_POLYLINE));
	rb_define_const(rb_mCd,"SIM_POLYGON",INT2FIX(CD_SIM_POLYGON));
	rb_define_const(rb_mCd,"SIM_TEXT",INT2FIX(CD_SIM_TEXT));
	rb_define_const(rb_mCd,"SIM_ALL",INT2FIX(CD_SIM_ALL));
	rb_define_const(rb_mCd,"SIM_LINES",INT2FIX(CD_SIM_LINES));
	rb_define_const(rb_mCd,"SIM_FILLS",INT2FIX(CD_SIM_FILLS));
	rb_define_const(rb_mCd,"RED",INT2FIX(CD_RED));
	rb_define_const(rb_mCd,"DARK_RED",INT2FIX(CD_DARK_RED));
	rb_define_const(rb_mCd,"GREEN",INT2FIX(CD_GREEN));
	rb_define_const(rb_mCd,"DARK_GREEN",INT2FIX(CD_DARK_GREEN));
	rb_define_const(rb_mCd,"BLUE",INT2FIX(CD_BLUE));
	rb_define_const(rb_mCd,"DARK_BLUE",INT2FIX(CD_DARK_BLUE));
	rb_define_const(rb_mCd,"YELLOW",INT2FIX(CD_YELLOW));
	rb_define_const(rb_mCd,"DARK_YELLOW",INT2FIX(CD_DARK_YELLOW));
	rb_define_const(rb_mCd,"MAGENTA",INT2FIX(CD_MAGENTA));
	rb_define_const(rb_mCd,"DARK_MAGENTA",INT2FIX(CD_DARK_MAGENTA));
	rb_define_const(rb_mCd,"CYAN",INT2FIX(CD_CYAN));
	rb_define_const(rb_mCd,"DARK_CYAN",INT2FIX(CD_DARK_CYAN));
	rb_define_const(rb_mCd,"WHITE",INT2FIX(CD_WHITE));
	rb_define_const(rb_mCd,"BLACK",INT2FIX(CD_BLACK));
	rb_define_const(rb_mCd,"DARK_GRAY",INT2FIX(CD_DARK_GRAY));
	rb_define_const(rb_mCd,"GRAY",INT2FIX(CD_GRAY));
	rb_define_const(rb_mCd,"MM2PT",rb_float_new(CD_MM2PT));
	rb_define_const(rb_mCd,"RAD2DEG",rb_float_new(CD_RAD2DEG));
	rb_define_const(rb_mCd,"DEG2RAD",rb_float_new(CD_DEG2RAD));
	rb_define_const(rb_mCd,"A0",INT2FIX(CD_A0));
	rb_define_const(rb_mCd,"A1",INT2FIX(CD_A1));
	rb_define_const(rb_mCd,"A2",INT2FIX(CD_A2));
	rb_define_const(rb_mCd,"A3",INT2FIX(CD_A3));
	rb_define_const(rb_mCd,"A4",INT2FIX(CD_A4));
	rb_define_const(rb_mCd,"A5",INT2FIX(CD_A5));
	rb_define_const(rb_mCd,"LETTER",INT2FIX(CD_LETTER));
	rb_define_const(rb_mCd,"LEGAL",INT2FIX(CD_LEGAL));
	
	rb_define_module_function(rb_mCd, "Version", rb_cdVersion, 0);
	rb_define_module_function(rb_mCd, "VersionDate", rb_cdVersionDate, 0);
	rb_define_module_function(rb_mCd, "ActiveCanvas", rb_cdActiveCanvas, 0);
	rb_define_method(rb_cCdCanvas, "Activate", rb_cdActivate, 0);
	rb_define_module_function(rb_mCd, "CreateCanvas", rb_cdCreateCanvas, 2);
	rb_define_method(rb_cCdCanvas, "KillCanvas", rb_cdKillCanvas, 0);
	rb_define_method(rb_cCdCanvas, "CanvasGetContext", rb_cdCanvasGetContext, 0);
	rb_define_method(rb_cCdCanvas, "CanvasActivate", rb_cdCanvasActivate, 0);
	rb_define_method(rb_cCdCanvas, "CanvasDeactivate", rb_cdCanvasDeactivate, 0);
	rb_define_module_function(rb_mCd, "UseContextPlus", rb_cdUseContextPlus, 0);
	rb_define_module_function(rb_mCd, "ContextRegisterCallback", rb_cdContextRegisterCallback, 3);
	rb_define_module_function(rb_mCd, "ContextCaps", rb_cdContextCaps, 1);
	rb_define_method(rb_cCdCanvas, "CanvasSimulate", rb_cdCanvasSimulate, 1);
	rb_define_method(rb_cCdCanvas, "CanvasFlush", rb_cdCanvasFlush, 0);
	rb_define_method(rb_cCdCanvas, "CanvasClear", rb_cdCanvasClear, 0);
	rb_define_method(rb_cCdCanvas, "CanvasSaveState", rb_cdCanvasSaveState, 0);
	rb_define_method(rb_cCdCanvas, "CanvasRestoreState", rb_cdCanvasRestoreState, 1);
	rb_define_module_function(rb_mCd, "ReleaseState", rb_cdReleaseState, 1);
	rb_define_method(rb_cCdCanvas, "CanvasSetAttribute", rb_cdCanvasSetAttribute, 2);
	rb_define_method(rb_cCdCanvas, "CanvasGetAttribute", rb_cdCanvasGetAttribute, 1);
	rb_define_method(rb_cCdCanvas, "CanvasPlay", rb_cdCanvasPlay, 6);
	rb_define_method(rb_cCdCanvas, "CanvasGetSize", rb_cdCanvasGetSize, 4);
	rb_define_method(rb_cCdCanvas, "CanvasUpdateYAxis", rb_cdCanvasUpdateYAxis, 1);
	rb_define_method(rb_cCdCanvas, "fCanvasUpdateYAxis", rb_cdfCanvasUpdateYAxis, 1);
	rb_define_method(rb_cCdCanvas, "CanvasInvertYAxis", rb_cdCanvasInvertYAxis, 1);
	rb_define_method(rb_cCdCanvas, "fCanvasInvertYAxis", rb_cdfCanvasInvertYAxis, 1);
	rb_define_method(rb_cCdCanvas, "CanvasMM2Pixel", rb_cdCanvasMM2Pixel, 2);
	rb_define_method(rb_cCdCanvas, "CanvasPixel2MM", rb_cdCanvasPixel2MM, 2);
	rb_define_method(rb_cCdCanvas, "fCanvasMM2Pixel", rb_cdfCanvasMM2Pixel, 2);
	rb_define_method(rb_cCdCanvas, "fCanvasPixel2MM", rb_cdfCanvasPixel2MM, 2);
	rb_define_method(rb_cCdCanvas, "CanvasOrigin", rb_cdCanvasOrigin, 2);
	rb_define_method(rb_cCdCanvas, "fCanvasOrigin", rb_cdfCanvasOrigin, 2);
	rb_define_method(rb_cCdCanvas, "CanvasGetOrigin", rb_cdCanvasGetOrigin, 0);
	rb_define_method(rb_cCdCanvas, "fCanvasGetOrigin", rb_cdfCanvasGetOrigin, 2);
	rb_define_method(rb_cCdCanvas, "CanvasTransform", rb_cdCanvasTransform, 1);
	rb_define_method(rb_cCdCanvas, "CanvasGetTransform", rb_cdCanvasGetTransform, 0);
	rb_define_method(rb_cCdCanvas, "CanvasTransformMultiply", rb_cdCanvasTransformMultiply, 1);
	rb_define_method(rb_cCdCanvas, "CanvasTransformRotate", rb_cdCanvasTransformRotate, 1);
	rb_define_method(rb_cCdCanvas, "CanvasTransformScale", rb_cdCanvasTransformScale, 2);
	rb_define_method(rb_cCdCanvas, "CanvasTransformTranslate", rb_cdCanvasTransformTranslate, 2);
	rb_define_method(rb_cCdCanvas, "CanvasTransformPoint", rb_cdCanvasTransformPoint,2);
	rb_define_method(rb_cCdCanvas, "fCanvasTransformPoint", rb_cdfCanvasTransformPoint, 2);
	rb_define_method(rb_cCdCanvas, "CanvasClip", rb_cdCanvasClip, 1);
	rb_define_method(rb_cCdCanvas, "CanvasClipArea", rb_cdCanvasClipArea, 4);
	rb_define_method(rb_cCdCanvas, "CanvasGetClipArea", rb_cdCanvasGetClipArea, 0);
	rb_define_method(rb_cCdCanvas, "fCanvasClipArea", rb_cdfCanvasClipArea, 4);
	rb_define_method(rb_cCdCanvas, "fCanvasGetClipArea", rb_cdfCanvasGetClipArea, 0);
	rb_define_method(rb_cCdCanvas, "CanvasIsPointInRegion", rb_cdCanvasIsPointInRegion, 2);
	rb_define_method(rb_cCdCanvas, "CanvasOffsetRegion", rb_cdCanvasOffsetRegion, 2);
	rb_define_method(rb_cCdCanvas, "CanvasGetRegionBox", rb_cdCanvasGetRegionBox, 0);
	rb_define_method(rb_cCdCanvas, "CanvasRegionCombineMode", rb_cdCanvasRegionCombineMode, 1);
	rb_define_method(rb_cCdCanvas, "CanvasPixel", rb_cdCanvasPixel, 3);
	rb_define_method(rb_cCdCanvas, "CanvasMark", rb_cdCanvasMark, 2);
	rb_define_method(rb_cCdCanvas, "CanvasLine", rb_cdCanvasLine, 4);
	rb_define_method(rb_cCdCanvas, "CanvasBegin", rb_cdCanvasBegin, 1);
	rb_define_method(rb_cCdCanvas, "CanvasVertex", rb_cdCanvasVertex, 2);
	rb_define_method(rb_cCdCanvas, "CanvasEnd", rb_cdCanvasEnd, 0);
	rb_define_method(rb_cCdCanvas, "CanvasRect", rb_cdCanvasRect, 4);
	rb_define_method(rb_cCdCanvas, "CanvasBox", rb_cdCanvasBox, 4);
	rb_define_method(rb_cCdCanvas, "CanvasArc", rb_cdCanvasArc, 6);
	rb_define_method(rb_cCdCanvas, "CanvasSector", rb_cdCanvasSector, 6);
	rb_define_method(rb_cCdCanvas, "CanvasChord", rb_cdCanvasChord, 6);
	rb_define_method(rb_cCdCanvas, "CanvasText", rb_cdCanvasText, 3);
	rb_define_method(rb_cCdCanvas, "fCanvasLine", rb_cdfCanvasLine, 4);
	rb_define_method(rb_cCdCanvas, "fCanvasVertex", rb_cdfCanvasVertex, 2);
	rb_define_method(rb_cCdCanvas, "fCanvasRect", rb_cdfCanvasRect, 4);
	rb_define_method(rb_cCdCanvas, "fCanvasBox", rb_cdfCanvasBox, 4);
	rb_define_method(rb_cCdCanvas, "fCanvasArc", rb_cdfCanvasArc, 6);
	rb_define_method(rb_cCdCanvas, "fCanvasSector", rb_cdfCanvasSector, 6);
	rb_define_method(rb_cCdCanvas, "fCanvasChord", rb_cdfCanvasChord, 6);
	rb_define_method(rb_cCdCanvas, "fCanvasText", rb_cdfCanvasText, 3);
	rb_define_method(rb_cCdCanvas, "CanvasSetBackground", rb_cdCanvasSetBackground, 1);
	rb_define_method(rb_cCdCanvas, "CanvasSetForeground", rb_cdCanvasSetForeground, 1);
	rb_define_method(rb_cCdCanvas, "CanvasBackground", rb_cdCanvasBackground, 1);
	rb_define_method(rb_cCdCanvas, "CanvasForeground", rb_cdCanvasForeground, 1);
	rb_define_method(rb_cCdCanvas, "CanvasBackOpacity", rb_cdCanvasBackOpacity, 1);
	rb_define_method(rb_cCdCanvas, "CanvasWriteMode", rb_cdCanvasWriteMode, 1);
	rb_define_method(rb_cCdCanvas, "CanvasLineStyle", rb_cdCanvasLineStyle, 1);
	rb_define_method(rb_cCdCanvas, "CanvasLineStyleDashes", rb_cdCanvasLineStyleDashes, 1);
	rb_define_method(rb_cCdCanvas, "CanvasLineWidth", rb_cdCanvasLineWidth, 1);
	rb_define_method(rb_cCdCanvas, "CanvasLineJoin", rb_cdCanvasLineJoin, 1);
	rb_define_method(rb_cCdCanvas, "CanvasLineCap", rb_cdCanvasLineCap, 1);
	rb_define_method(rb_cCdCanvas, "CanvasInteriorStyle", rb_cdCanvasInteriorStyle, 1);
	rb_define_method(rb_cCdCanvas, "CanvasHatch", rb_cdCanvasHatch, 1);
	rb_define_method(rb_cCdCanvas, "CanvasStipple", rb_cdCanvasStipple, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetStipple", rb_cdCanvasGetStipple, 2);
	rb_define_method(rb_cCdCanvas, "CanvasPattern", rb_cdCanvasPattern, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetPattern", rb_cdCanvasGetPattern, 0);
	rb_define_method(rb_cCdCanvas, "CanvasFillMode", rb_cdCanvasFillMode, 1);
	rb_define_method(rb_cCdCanvas, "CanvasFont", rb_cdCanvasFont, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetFont", rb_cdCanvasGetFont, 0);
	rb_define_method(rb_cCdCanvas, "CanvasNativeFont", rb_cdCanvasNativeFont, 1);
	rb_define_method(rb_cCdCanvas, "CanvasTextAlignment", rb_cdCanvasTextAlignment, 1);
	rb_define_method(rb_cCdCanvas, "CanvasTextOrientation", rb_cdCanvasTextOrientation, 1);
	rb_define_method(rb_cCdCanvas, "CanvasMarkType", rb_cdCanvasMarkType, 1);
	rb_define_method(rb_cCdCanvas, "CanvasMarkSize", rb_cdCanvasMarkSize, 1);
	rb_define_method(rb_cCdCanvas, "CanvasVectorText", rb_cdCanvasVectorText, 3);
	rb_define_method(rb_cCdCanvas, "CanvasMultiLineVectorText", rb_cdCanvasMultiLineVectorText, 3);
	rb_define_method(rb_cCdCanvas, "CanvasVectorFont", rb_cdCanvasVectorFont, 1);
	rb_define_method(rb_cCdCanvas, "CanvasVectorTextDirection", rb_cdCanvasVectorTextDirection, 4);
	rb_define_method(rb_cCdCanvas, "CanvasVectorTextTransform", rb_cdCanvasVectorTextTransform, 1);
	rb_define_method(rb_cCdCanvas, "CanvasVectorTextSize", rb_cdCanvasVectorTextSize, 3);
	rb_define_method(rb_cCdCanvas, "CanvasVectorCharSize", rb_cdCanvasVectorCharSize, 1);
	rb_define_method(rb_cCdCanvas, "CanvasGetVectorTextSize", rb_cdCanvasGetVectorTextSize, 1);
	rb_define_method(rb_cCdCanvas, "CanvasGetVectorTextBounds", rb_cdCanvasGetVectorTextBounds, 4);
	rb_define_method(rb_cCdCanvas, "CanvasGetFontDim", rb_cdCanvasGetFontDim, 0);
	rb_define_method(rb_cCdCanvas, "CanvasGetTextSize", rb_cdCanvasGetTextSize, 1);
	rb_define_method(rb_cCdCanvas, "CanvasGetTextBox", rb_cdCanvasGetTextBox, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetTextBounds", rb_cdCanvasGetTextBounds, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetColorPlanes", rb_cdCanvasGetColorPlanes, 0);
	rb_define_method(rb_cCdCanvas, "CanvasPalette", rb_cdCanvasPalette, 3);
	rb_define_method(rb_cCdCanvas, "CanvasGetImageRGB", rb_cdCanvasGetImageRGB, 4);
	rb_define_method(rb_cCdCanvas, "CanvasPutImageRectRGB", rb_cdCanvasPutImageRectRGB, 13);
	rb_define_method(rb_cCdCanvas, "CanvasPutImageRectRGBA", rb_cdCanvasPutImageRectRGBA, 14);
	rb_define_method(rb_cCdCanvas, "CanvasPutImageRectMap", rb_cdCanvasPutImageRectMap, 12);
	rb_define_method(rb_cCdCanvas, "CanvasCreateImage", rb_cdCanvasCreateImage, 2);
	rb_define_module_function(rb_mCd, "KillImage", rb_cdKillImage, 1);
	rb_define_method(rb_cCdCanvas, "CanvasGetImage", rb_cdCanvasGetImage, 3);
	rb_define_method(rb_cCdCanvas, "CanvasPutImageRect", rb_cdCanvasPutImageRect, 7);
	rb_define_method(rb_cCdCanvas, "CanvasScrollArea", rb_cdCanvasScrollArea, 6);
	rb_define_module_function(rb_mCd, "CreateBitmap", rb_cdCreateBitmap, 3);
	rb_define_module_function(rb_mCd, "InitBitmap", rb_cdInitBitmap, -1);
	rb_define_module_function(rb_mCd, "KillBitmap", rb_cdKillBitmap, 1);
	rb_define_module_function(rb_mCd, "BitmapGetData", rb_cdBitmapGetData, 2);
	rb_define_module_function(rb_mCd, "BitmapSetRect", rb_cdBitmapSetRect, 5);
	rb_define_method(rb_cCdCanvas, "CanvasPutBitmap", rb_cdCanvasPutBitmap, 5);
	rb_define_method(rb_cCdCanvas, "CanvasGetBitmap", rb_cdCanvasGetBitmap, 3);
	rb_define_module_function(rb_mCd, "BitmapRGB2Map", rb_cdBitmapRGB2Map, 2);
	rb_define_module_function(rb_mCd, "EncodeColor", rb_cdEncodeColor, 3);
	rb_define_module_function(rb_mCd, "DecodeColor", rb_cdDecodeColor, 1);
	rb_define_module_function(rb_mCd, "DecodeAlpha", rb_cdDecodeAlpha, 1);
	rb_define_module_function(rb_mCd, "EncodeAlpha", rb_cdEncodeAlpha, 2);
	rb_define_module_function(rb_mCd, "Alpha", rb_cdAlpha, 1);
	rb_define_module_function(rb_mCd, "Reserved", rb_cdReserved, 1);
	rb_define_module_function(rb_mCd, "Red", rb_cdRed, 1);
	rb_define_module_function(rb_mCd, "Green", rb_cdGreen, 1);
	rb_define_module_function(rb_mCd, "Blue", rb_cdBlue, 1);
	rb_define_module_function(rb_mCd, "RGB2Map", rb_cdRGB2Map, 8);
	rb_define_module_function(rb_mCd, "ContextIup", rb_cdContextIup, 0);
	rb_define_module_function(rb_mCd, "CD_IUP", rb_cdContextIup, 0);
	rb_define_module_function(rb_mCd, "Iup", rb_cdContextIup, 0);
	rb_define_module_function(rb_mCd, "ContextPDF", rb_cdContextPDF, 0);
	
	rb_IupOpen(rb_mIup);
	IupSetLanguage(IUP_ENGLISH);

	atexit(exit_handler);
}
